Fix test_calendar tests

This commit is contained in:
Noah committed 2020-09-01 15:21:29 -05:00
1 parent f98a381931
commit 717784d38a
5 files changed
+17 -9

No files matched your search

Generated
+1
View File
@@ -1585,6 +1585,7 @@ dependencies = [
"env_logger",
"flame",
"flamescope",
"libc",
"log",
"num-traits",
"rustpython-compiler",
+1
View File
@@ -35,6 +35,7 @@ pylib = { package = "rustpython-pylib", path = "vm/pylib-crate", version = "0.1.
dirs = { package = "dirs-next", version = "1.0" }
num-traits = "0.2.8"
cfg-if = "0.1"
libc = "0.2"
flame = { version = "0.2", optional = true }
flamescope = { version = "0.1", optional = true }
+2 -2
View File
@@ -1006,8 +1006,8 @@ def PyUnicode_DecodeUTF16Stateful(s, size, errors, byteorder='native', final=Tru
# have any nested variables.
def STORECHAR(CH, byteorder):
hi = chr(((CH) >> 8) & 0xff)
lo = chr((CH) & 0xff)
hi = (CH >> 8) & 0xff
lo = CH & 0xff
if byteorder == 'little':
return [lo, hi]
else:
-7
View File
@@ -817,18 +817,14 @@ class CommandLineTestCase(unittest.TestCase):
self.assertIn(b'January', stdout)
self.assertIn(b'Mo Tu We Th Fr Sa Su', stdout)
@unittest.skipIf(sys.platform == 'win32', 'TODO: RUSTPYTHON Windows')
def test_output_year(self):
stdout = self.run_ok('2004')
self.assertEqual(stdout, conv(result_2004_text))
@unittest.skipIf(sys.platform == 'win32', 'TODO: RUSTPYTHON Windows')
def test_output_month(self):
stdout = self.run_ok('2004', '1')
self.assertEqual(stdout, conv(result_2004_01_text))
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_option_encoding(self):
self.assertFailure('-e')
self.assertFailure('--encoding')
@@ -860,7 +856,6 @@ class CommandLineTestCase(unittest.TestCase):
stdout = self.run_ok('--width', '3', '2004')
self.assertIn(b'Mon Tue Wed Thu Fri Sat Sun', stdout)
@unittest.skipIf(sys.platform == 'win32', 'TODO: RUSTPYTHON Windows')
def test_option_lines(self):
self.assertFailure('-l')
self.assertFailure('--lines')
@@ -875,7 +870,6 @@ class CommandLineTestCase(unittest.TestCase):
stdout = self.run_ok('--spacing', '8', '2004')
self.assertIn(b'Su Mo', stdout)
@unittest.skipIf(sys.platform == 'win32', 'TODO: RUSTPYTHON Windows')
def test_option_months(self):
self.assertFailure('-m')
self.assertFailure('--month')
@@ -883,7 +877,6 @@ class CommandLineTestCase(unittest.TestCase):
stdout = self.run_ok('--months', '1', '2004')
self.assertIn(conv('\nMo Tu We Th Fr Sa Su\n'), stdout)
@unittest.skipIf(sys.platform == 'win32', 'TODO: RUSTPYTHON Windows')
def test_option_type(self):
self.assertFailure('-t')
self.assertFailure('--type')
+13
View File
@@ -36,6 +36,19 @@ fn main() {
settings.initialization_parameter = InitParameter::InitializeInternal;
}
// don't translate newlines (\r\n <=> \n)
#[cfg(windows)]
{
extern "C" {
fn _setmode(fd: i32, flags: i32) -> i32;
}
unsafe {
_setmode(0, libc::O_BINARY);
_setmode(1, libc::O_BINARY);
_setmode(2, libc::O_BINARY);
}
}
let vm = VirtualMachine::new(settings);
let res = run_rustpython(&vm, &matches);